



#include "mainwindow.h"
#include "gpssrunner.h"
MyWindow::MyWindow(QWidget *parent):QWidget(parent)
{
    QVBoxLayout *layMain = new QVBoxLayout();
    QPushButton *butStart = new QPushButton("Start thread");
    layMain->addWidget(butStart);
    QHBoxLayout *laySec = new QHBoxLayout();
    QLabel *lblSec = new QLabel("Seconds: ");
    ebSec = new QLineEdit();
    laySec->addWidget(lblSec);
    laySec->addWidget(ebSec);
    layMain->addLayout(laySec);
    area = new MyArea();
    layMain->addWidget(area);
    this->setLayout(layMain);
    GpssRunner *runner = new GpssRunner();
    connect(butStart, SIGNAL(pressed()),runner, SLOT(runModel()));
    connect(runner,SIGNAL(signalFinished(int)), this, SLOT(slotValueChanged(int)));
    connect(runner, SIGNAL(signalGenFinished()), area, SLOT(slotAddLayout()));
    connect(runner, SIGNAL(signalFinished(int)), area, SLOT(slotAddButtonLayout(int)));

    //connect(butStart, SIGNAL(pressed()),this, SLOT(slotProcPressed()));
}
void MyWindow::slotValueChanged(int value)
{
    QString str;
    ebSec->setText(str.append(QString("%1").arg(value)));
}
void MyWindow::slotProcPressed()
{

    /*timer = new MyTimer();
    connect(timer, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged(int)));
    connect(timer, SIGNAL(valueChanged(int)),area, SLOT(slotAddButtonLayout(int)));*/

}
